]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowManager: Respect icon geometry when minimizing
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 21 Jan 2013 21:21:08 +0000 (22:21 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 1 Feb 2013 16:38:33 +0000 (17:38 +0100)
When using a dock or window-list with the shell, it makes sense for
us to minimize to the location requested rather than the activities
button.

https://bugzilla.gnome.org/show_bug.cgi?id=692997

js/ui/windowManager.js

index 35b67992be8c6bf512bb80b7d08a9b45300e1f6a..2b1af8fd5e542d64750561379c7d981e6e60a268 100644 (file)
@@ -242,22 +242,30 @@ const WindowManager = new Lang.Class({
         }
 
         actor.set_scale(1.0, 1.0);
-        actor.move_anchor_point_from_gravity(Clutter.Gravity.CENTER);
 
-        /* scale window down to 0x0.
-         * maybe TODO: get icon geometry passed through and move the window towards it?
-         */
         this._minimizing.push(actor);
 
-        let monitor = Main.layoutManager.findMonitorForWindow(actor.meta_window);
-        let xDest = monitor.x;
-        let yDest = monitor.y;
-        if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
-            xDest += monitor.width;
+        let xDest, yDest, xScale, yScale;
+        let [success, geom] = actor.meta_window.get_icon_geometry();
+        if (success) {
+            xDest = geom.x;
+            yDest = geom.y;
+            xScale = geom.width / actor.width;
+            yScale = geom.height / actor.height;
+        } else {
+            /* scale window down to 0x0.  */
+            let monitor = Main.layoutManager.findMonitorForWindow(actor.meta_window);
+            xDest = monitor.x;
+            yDest = monitor.y;
+            xScale = 0.0;
+            yScale = 0.0;
+            if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
+                xDest += monitor.width;
+        }
 
         Tweener.addTween(actor,
-                         { scale_x: 0.0,
-                           scale_y: 0.0,
+                         { scale_x: xScale,
+                           scale_y: yScale,
                            x: xDest,
                            y: yDest,
                            time: WINDOW_ANIMATION_TIME,